Skip to content
Chuck Scott edited this page May 10, 2013 · 57 revisions

Installing

plugin version 1.0 supports Rundeck API v2

plugin version 1.1 supports Rundeck API v6 (supports rundeck logging over api connection)

plugin version 1.2 supports Rundeck API v6 (supports double quoted parameters as a single string)

The Rundeck plugin distribution is now hosted in the Atlassian Plugin Exchange and through Bamboo's UPM (Universal Plugin Manager), it may be simply searched for and installed. Alternatively, snapshot distributions may be installed using the UPM by referring to specific URL.

NOTE: There is a runtime dependency issue with the Bamboo Jetty container where dom4j conflicts with the compiled dom4j in this plugin leading to xml parsing issues. Check the following library should you be using the bundled jetty container:

webapp/WEB-INF/lib/dom4j-1.4.jar

remove this jar and replace with:

webapp/WEB-INF/lib/dom4j-1.6.1.jar

see: dom4j downloads

Example plugin installation (requires Bamboo administrative privileges)

  • Using the Bamboo Admin Interface, navigate to the Plugin Manager under Plugins bamboo plugin manager
  • Go to the Install tab: bamboo plugin manager install
  • Search for the Rundeck plugin: bamboo plugin manager upload
  • Select the plugin and Install Now: installNowinstalled

Example bamboo-rundeck-plugin configuration

Configuring this plugin depends on the following:

  • Global (recommended) Bamboo variable rundeck.url, e.g. http://charles-scotts-dto-macbook-pro.local:4440. See bamboo variables for more information. NOTE: A Global variable allows us to reuse this url across different build plans.
  • An existing Bamboo plan configured with the rundeck.apiToken variable. See Rundeck's Generating API Tokens for more information. NOTE: rundeck.apiUsername and rundeck.apiPassword variables are alternatives to using the apiToken method, however, api token plugin is used in this example. NOTE: We configure authentication with a plan variable as opposed to a global variable since other build plans may require different access rights depending on how Rundeck ACL Policies are configured.
  • In this example there exists a rundeck job requiring a version parameter. Note the following images describing this particular rundeck job which is executed via the Rundeck UI. The bamboo-rundeck-plugin will execute the same job using Rundeck's API.

bamboo plugin manager installed bamboo plugin manager installed bamboo plugin manager installed

Configuring the rundeck-apitoken-plugin task

This task depends on both the rundeck.url and rundeck.apiToken bamboo variables described above. Alternatively, if the rundeck-apiuserpass-plugin task is being configured then instead of rundeck.apiToken, we would need rundeck.apiUser and rundeck.apiPassword variables.

  • Using the Bamboo Admin Interface, navigate to Global Variables: bamboo global variables

  • Define the rundeck.url global variable: bamboo rundeck.url variable

  • Define the rundeck.apiToken plan variable: bamboo rundeck.apiToken variable

  • Configure the bamboo job with the rundeck api-token task: MyAppBuildJob addTaskMyAppBuildJob addTaskMyAppBuildJob addTaskSelectApiTokenMyAppBuildJob addTaskSelectApiTokenMyAppBuildJobParameters addTaskSelectApiTokenMyAppBuildJobParametersSave

  • After a successful run the bamboo job will produce log output similar to the following:

    using extra environment variables: bamboo_rundeck_url=http://charles-scotts-dto-macbook-pro.local:4440 bamboo_rundeck_apiToken=V8eNv87cnE41Pk4oK7RU55P7pudUC3V2

    simple 04-Mar-2012 14:28:51 Finished task 'createbuild'

    simple 04-Mar-2012 14:28:51 Starting task 'execute rundeck deployMyApp job' of type 'com.dtolabs.bamboo.plugin.bamboo-rundeck-plugin:rundeck-apitoken-plugin'

    simple 04-Mar-2012 14:28:51 getting rundeck api token from bamboo variable: rundeck.apiToken

    simple 04-Mar-2012 14:28:51 plan variable: rundeck.disable not defined, automatically setting to false

    simple 04-Mar-2012 14:28:51 getting rundeck jobId from task param: jobId

    simple 04-Mar-2012 14:28:51 getting jobArgs from param: INLINE

    simple 04-Mar-2012 14:28:51 getting rundeck url from bamboo variable: rundeck.url

    simple 04-Mar-2012 14:28:51 constructing RundeckClient using api token method

    simple 04-Mar-2012 14:28:51 pinging rundeck server

    simple 04-Mar-2012 14:28:52 running rundeck job, jobId: devops-integration-deployMyApp with argProperties: {version=1.0}

    simple 04-Mar-2012 14:28:57 Finished task 'execute rundeck deployMyApp job'

Using INLINE versus FILE Parameters

The above example shows parameters being provided using the INLINE method where the value for a parameter is known prior to the Bamboo build. Often times, the value for a parameter will be derived during build time. The FILE method allows us to provide the parameters in a file. The FILE method, as opposed to the above INLINE method is described here.

  • First we use a Script task to generate a properties file which will be executed prior to the Rundeck task. NOTE: The script method shown here is simple in nature. The only requirement is that each property name is unique and commonly prefixed with the following:

bamboo_rundeck_plugin.jobArgs.

Other properties will be ignored. addGenerateRundeckProperties

  • Then we reconfigure the Rundeck task to use the FILE method and refer to the previously generated file. setFileRundeckProperties